/**
 * @author Kristian Mandrup
 * @date June 10, 2009
 * @version 0.1
 * 
 * m3gen :: exception
 * 
 * - Defines exception Error objects that can be thrown within the framework
 */
// 'exception' namespace
m3gen.exception = {};

m3gen.exception.InvalidOptions = new Error("Invalid options");
m3gen.exception.InvalidCreateOptions = new Error("Invalid create options");
m3gen.exception.InvalidGlobalExecState = new Error("Invalid Global Exec State");
m3gen.exception.MissingConstructorArgument = new Error("Missing constructor argument");

// JsTreeModelGenerator exception
m3gen.exception.MissingGeneratorModel = new Error ("JsTreeModelGenerator constructor requires a GeneratorModel object as its first argument"); 
m3gen.exception.MissingJsonInstanceModel = new Error ("JsTreeModelGenerator.execute requires a jsonInstanceModel"); 

m3gen.exception.InvalidJsonObject = new Error("Invalid JsonObj");
m3gen.exception.InvalidObjType = new Error("Invalid objType");
m3gen.exception.InvalidRuleSet = new Error("Invalid ruleSet");
// JsTreeNodeBuilder exception
m3gen.exception.MissingNodeObject = new Error("JsTreeNodeBuilder constructor requires a NodeObj object as its first argument")

// JSONObjParser exception
m3gen.exception.MissingRuleSetConfiguration = new Error("JSONObjParser constructor requires a ruleSetConfiguration");
 
m3gen.exception.MissingRuleSetForObjType = new Error("Missing a matching ruleSet for objType encountered");

// Creating NodeObj
m3gen.exception.MissingIdRule = new Error("JSONObjParser.resolveId requires a title rule in the active ruleset");
m3gen.exception.MissingAttributesRule = new Error("JSONObjParser.resolveAttributes requires a title rule in the active ruleset");
m3gen.exception.MissingStateRule = new Error("JSONObjParser.resolveState requires a title rule in the active ruleset");
m3gen.exception.MissingIconRule = new Error("JSONObjParser.resolveLanguageIcon requires a select icon rule in the active ruleset");
m3gen.exception.MissingTitleRule = new Error("JSONObjParser.resolveLanguageTitle Missing select title rule");

m3gen.exception.InvalidJsTreeNode = new Error("Invalid jsTree node");

// language specific
m3gen.exception.MissingLanguagesRule = new Error("JSONObjParser.resolveLanguages requires a language rule in the active ruleset");
m3gen.exception.MissingLanguageTitleRule = new Error("JSONObjParser.resolveLanguageTitle requires a title rule in the active ruleset");
m3gen.exception.MissingLanguageIconRule = new Error("JSONObjParser.resolverLanguageIcon requires an icon rule in the active ruleset");
m3gen.exception.MissingLanguageAttributesRule = new Error("JSONObjParser.resolveLanguageAttributes requires a title rule in the active ruleset");
m3gen.exception.MissingChildrenRule = new Error("JSONObjParser.resolveChildren requires a children rule in the active ruleset");

// ChildParser
m3gen.exception.MissingChildSelectors = new Error("ChildParser.parseChildren missing child selectors");


m3gen.exception.handler = function mainExceptionHandler(e) {
  console.log('EXCEPTION:' + e.message);
}